import {
    httpGet,
    httpPost
} from '../../../libs/http'
import { formatScheduleData } from './utils'

export async function getInitialData(){
    const {
        schedule,
        course,
        duration,
        teacher} =  await httpGet('http://localhost:3000/initial_data')
        return  Promise.resolve({
            schedule:formatScheduleData(schedule),
            course,
            duration,
            teacher
        })

}

export async function  updateSchedule(data){
    const url = 'http://localhost:3000/update_schedule'
    return await httpPost(url,data)
}

export async function  removeSchedule(id){
    const url = 'http://localhost:3000/remove_schedule'
    return await httpPost(url, {id})
    
}